package joyi.train.employee.qmd;

import j.framework.core.LoginUser;
import j.framework.qmd.core.QueryDataHandler;
import j.framework.qmd.core.QueryFieldMetadata;
import j.framework.qmd.core.QueryMetadata;
import j.framework.qmd.core.QueryResult;
import j.util.jdbc.QueryJdbcTemplate;

import java.util.List;
import java.util.Map;

/**
 * Created by WY2015092804 on 2015/10/23.
 */
public class PositionQueryHanlder implements QueryDataHandler{
    @Override
    public Object getColumnValue(QueryFieldMetadata fieldMetadata, Object value, Map<String, Object> rowData) {

        return value;
    }

    @Override
    public String buildWhereClause(LoginUser user, Map<String, String> queryParams, List<Object> args) {
        return null;
    }

    @Override
    public void prepareCall(LoginUser user, Map<String, String> queryParams, Map<String, Object> callParams) {

    }

    @Override
    public String getOperatorHtml(LoginUser user, Map<String, Object> rowData) {
        StringBuilder opt = new StringBuilder();
        opt.append("<a href='javascript:void(0);' onclick=\"editPosition('"+rowData.get("positionId")+"')\">编辑</a>");
        opt.append(" <a href='javascript:void(0);' onclick=\"delPosition('"+rowData.get("positionId")+"')\">删除</a>");
        return opt.toString();
    }

    @Override
    public boolean beforeQuery(QueryJdbcTemplate qjt, QueryMetadata qmd, Map<String, String> queryParams, QueryResult queryResult) {
        return true;
    }

    @Override
    public void doAfterQuery(QueryJdbcTemplate qjt, QueryMetadata qmd, Map<String, String> queryParams, QueryResult queryResult) {

    }
}
